<template>
<div class="platformRecord">
    <!-- 列表展示 -->
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="parkName" label="停车场名称" align="center">
      </el-table-column>
      <el-table-column prop="ruleName" label="规则名称" align="center">
      </el-table-column>
      <el-table-column prop="describes" label="规则说明" align="center">
      </el-table-column>
      <el-table-column prop="monthAmount" label="月付" align="center">
      </el-table-column>
      <el-table-column prop="quarterAmount" label="季付" align="center">
      </el-table-column>
      <el-table-column prop="yearAmount" label="年付" align="center">
      </el-table-column>
      <el-table-column prop="soldCount" label="已售出" align="center">
      </el-table-column>
    </el-table>

    <!-- 分页 -->
    <el-pagination layout="total, sizes, prev, pager, next, jumper" :total="tal" :hide-on-single-page="true" background :page-size="10" :page-sizes="[5,8,10]" align="center" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="currentPage" style="margin-top:30px;">
    </el-pagination>

</div>
</template>

<script>
import axios from 'axios'
import qs from 'qs'

export default{
  name:'platformRecord',
  data(){
    return{
      searchData:{},
      tableData:[],
      tal:null,
      currentPage:1,
      }
  },
  mounted(){
    this.getTableData();//初始加载
  },
  methods:{
     //数据初始加载  分页查询数据  两者共用一个接口
    getTableData(){
      var userId = sessionStorage.getItem("userId");
      var token = sessionStorage.getItem("token");
      this.searchData.userId = userId;
      this.searchData.token = token;
      this.searchData.ruleType = 1;
      axios({
        method:'post',
        url:'/api/bElecard/selectAllEleCard',
        data:qs.stringify(this.searchData)
      }).then((res) => {
        this.tableData = res.data.data.list;
        this.tal = res.data.data.total;// 获取总条数
      })
    },
    //分页修改每页显示条数
    handleSizeChange(val){
      this.searchData.pageSize = val;
      this.getTableData();
    },
    //分页跳转页面
    handleCurrentChange(val){
      this.searchData.page = val;
      this.getTableData();
    },
    deleteRole(){

    }
  }
}
</script>

<style scoped>
.platformRecord{
  padding: 40px;
}

